/**
*********************************************************************************************************
*               Copyright(c) 2018, Realtek Semiconductor Corporation. All rights reserved.
**********************************************************************************************************
* @file
* @brief
* @details
* @author
* @date
* @version
*********************************************************************************************************
*/

/* Includes ------------------------------------------------------------------*/
#include "asr_rtl8763bo_port.h"

#if USE_LV_BLUETOOTH != 0

#include "hci_app.h"
#include "rtl8763bf_task.h"
#if 0
#include "rtl876x_pinmux.h"
#include "wristband_gap.h"
#include "gap_adv.h"
#include "board.h"
#include "communicate_protocol.h"
#include "wristband_global_data.h"
#include "app_flash_config.h"
#endif
#include "localplay.h"


T_MEDIA_INFO media_info = {0};

void save_media_list(uint8_t * name, uint32_t len)
{
#if 0
    APP_PRINT_INFO2("[HOWIE]media_info.had_scaned_list_num = %d, LINE = %d",
                    media_info.had_scaned_list_num, __LINE__);
    if(media_info.sync_start_status == 1) {
        APP_PRINT_INFO0("[HOWIE]media_info get list has been end!!!");
        return;
    } else if(media_info.had_scaned_list_num >= MAX_MUSIC_CNT) {
        APP_PRINT_INFO0("[HOWIE]media_info.music list is full");
        return;
    }
    media_info.music[media_info.had_scaned_list_num].name_addr = MUSIC_INFO_START_ADDRESS +
            media_info.had_scaned_list_num * 256;
    media_info.music[media_info.had_scaned_list_num].name_len = len / 2;
    flash_write_locked(media_info.music[media_info.had_scaned_list_num].name_addr, len, name);
    media_info.had_scaned_list_num++;
#endif
}

void prepare_get_media_list(void)
{
#if 0
    //do flash clear
    if(flash_erase_locked(FLASH_ERASE_SECTOR, MUSIC_INFO_START_ADDRESS) == false) {
        APP_PRINT_ERROR0("fs data erase error!");
    }
    //do media info struct clear
    memset(&media_info, 0, sizeof(media_info));
#endif
}

void get_current_play_list(uint8_t * name, uint32_t len)
{
#if 0
    if((media_info.had_scaned_list_num != 0) && (len != 0)) {
        for(uint16_t i = 0; i < media_info.had_scaned_list_num; i++) {
            if(len == (media_info.music[i].name_len * 2)) {
                if(memcmp((uint8_t *)media_info.music[i].name_addr, name, media_info.music[i].name_len) == 0) {
                    media_info.cur_select = i;
                    APP_PRINT_INFO1("media_info.cur_select is %d", media_info.cur_select);
                }
            }
        }
    }
#endif
}
void stop_get_media_list(void)
{
#if 0
    APP_PRINT_ERROR0("stop getting play list!");

    media_info.sync_start_status = 1;
#endif
}

#endif/*USE_LV_BLUETOOTH*/

/******************* (C) COPYRIGHT 2018 Realtek Semiconductor Corporation *****END OF FILE****/

